Skip to content

注入DLL - Inject

函数简介

向指定窗口进程注入DLL文件,支持多种注入类型和绕过保护选项。

接口名称

Inject

DLL调用

c
int32_t Inject(int64_t instance, int64_t hwnd, const char* dll_path, int32_t type, int32_t bypassGuard);

参数说明

参数名类型说明
instance长整数型OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。
hwnd长整数型目标窗口句柄, 可以通过SetMemoryHwndAsProcessId接口设置成传入进程ID。
dll_path字符串DLL文件的完整路径。
type整数型注入类型:1 标准注入(CreateRemoteThread),2 驱动注入模式1,3 驱动注入模式2,4 驱动注入模式3。
bypassGuard整数型是否绕过保护:0 不绕过,1 尝试绕过常见反注入保护。

示例

SDK 调用

cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
ola.Inject(pid, "C:\\tools\\helper.dll");
csharp
using OLAPlug;

var ola = new OLAPlugServer();
ola.Inject(pid, "C:\\tools\\helper.dll");
python
from OLAPlugServer import OLAPlugServer

ola = OLAPlugServer()
ola.Inject(pid, "C:\\tools\\helper.dll")
java
import com.olaplug.OLAPlugServer;

OLAPlugServer ola = new OLAPlugServer();
ola.Inject(pid, "C:\\tools\\helper.dll");
cpp
var ola = com("OlaPlug.OlaSoft")
ola.Inject(pid, "C:\\tools\\helper.dll");
vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
ola.Inject(pid, "C:\\tools\\helper.dll");
text
.局部变量 ola, OLAPlug
ola.创建 ()
ola.Inject(pid, "C:\\tools\\helper.dll")
aardio
import OLAPlugServer;
var ola = OLAPlugServer();
ola.Inject(pid, "C:\\tools\\helper.dll");
text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
ola.Inject(pid, "C:\\tools\\helper.dll");
cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
ola.Inject(pid, "C:\\tools\\helper.dll");

原生 DLL 调用

cpp
long instance = CreateCOLAPlugInterFace();
Inject(instance, pid, "C:\\tools\\helper.dll");
csharp
long instance = CreateCOLAPlugInterFace();
Inject(instance, pid, "C:\\tools\\helper.dll");
python
from ctypes import CDLL, c_int, c_int64, create_string_buffer

ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
Inject(instance, pid, "C:\\tools\\helper.dll")

返回值

返回值说明
1成功。
0失败。

注意事项

项目说明
路径DLL文件必须存在且路径正确。
权限目标进程必须有足够的权限允许注入。
不同注入类型的成功率和兼容性可能不同不同注入类型的成功率和兼容性可能不同。
标准注入(type=0)最稳定标准注入(type=0)最稳定,但容易被检测。
手动映射注入(type=3)隐蔽性最好手动映射注入(type=3)隐蔽性最好,但兼容性较差。
绕过保护选项可能无法对抗所有反注入机制绕过保护选项可能无法对抗所有反注入机制。
管理员权限注入系统进程或受保护进程需要管理员权限。
32位进程只能注入32位DLL32位进程只能注入32位DLL,64位进程只能注入64位DLL。
在注入前确认DLL的架构与目标进程匹配建议在注入前确认DLL的架构与目标进程匹配。
注入失败可能导致目标进程崩溃注入失败可能导致目标进程崩溃,请谨慎使用。
某些杀毒软件可能会拦截DLL注入操作某些杀毒软件可能会拦截DLL注入操作。